import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_color.dart';
/*
 TabBar,BottomNavigationBar
 */

//定义生成的文件
part 'x_bean_menu.g.dart';

//设备
@JsonSerializable(explicitToJson: true) //当内部存在嵌套类时使用,不存在也可以使用
class XBeanMenuItem {
  String? id;
  String? text;

  /*
  XImageUtils.imageLocal('assets/images/login_logo.png',width: 45,height: 52)
   */
  String? image;
  String? selectImage;

  String? image2;
  String? selectImage2;

  double imageWidth=20;
  double imageHeight=20;
  double? image2Width;
  double? image2Height;
  double textSize=12;
  double textSelectSize=12;

  //是否其他点击(不是bottomNavigationItemPage)
  bool isOtherControlOnClick=false;
  //是否选中状态
  bool isUserSelect=false;
  //是否组头
  bool isGroupItem=false;

  List<XBeanMenuItem>? subMenus;

  //默认颜色
  String? defaultColor;
  //选中颜色
  String? selectColor;

  bool isSelectTextFontWeightBold=false;

  dynamic data;

  XBeanMenuItem({
    this.id,
    this.text,
    this.image,
    this.selectImage,
    this.image2,
    this.selectImage2,
    this.imageWidth=20,
    this.imageHeight=20,
    this.image2Width,
    this.image2Height,
    this.textSize=12,
    this.textSelectSize=12,
    this.isUserSelect=false,
    this.isGroupItem=false,
    this.isOtherControlOnClick=false,
    this.data,
    this.subMenus,
    this.defaultColor,
    this.selectColor,
    this.isSelectTextFontWeightBold=false,
  });


  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is XBeanMenuItem &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          text == other.text;

  @override
  int get hashCode => id.hashCode ^ text.hashCode;

  //添加固定格式: _$自定义的类名FromJson  _$自定义的类名ToJson
  factory XBeanMenuItem.fromJson(Map<String, dynamic> json) => _$XBeanMenuItemFromJson(json);
  Map<String, dynamic> toJson() => _$XBeanMenuItemToJson(this);


}
